

package org.binarylook.nio;


import java.nio.channels.ReadableByteChannel;
import java.nio.channels.Channels;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.io.IOException;
import java.io.InputStream;




public class Channel {

    public Channel(){
    }
    public void readsystem(){

        try{

            ReadableByteChannel rbc =  Channels.newChannel(System.in);
            ByteBuffer buf          =  ByteBuffer.allocate(12);

            while(rbc.read(buf)!=-1){
                buf.flip();
                System.out.println(buf.toString());
                buf.clear();
            }
        }
        catch(IOException e){
            e.printStackTrace();

           
        }

    }
    public static void main(String arg[]){
        new Channel().readsystem();
    }
}